package com.zycfc.zsf.boot.util.io;

import com.zycfc.zsf.boot.util.text.*;
import java.io.*;

public abstract class GeneralResourceUtils
{
    public static final String CLASSPATH = "classpath://";
    public static final String FILE = "file://";
    
    public static InputStream asStream(final String generalPath) throws IOException {
        if (StringUtils.startsWith((CharSequence)generalPath, (CharSequence)"classpath://")) {
            final String resourceName = StringUtils.substringAfter(generalPath, "classpath://");
            return ResourceUtils.asStream(resourceName);
        }
        if (StringUtils.startsWith((CharSequence)generalPath, (CharSequence)"file://")) {
            final String fileName = StringUtils.substringAfter(generalPath, "file://");
            return FileUtils.asInputStream(fileName);
        }
        throw new IllegalArgumentException("unsupport resoure type:" + generalPath);
    }
}
